//
//  ChoosePatternViewController.m
//  project
//
//  Created by 张亚林 on 2017/10/27.
//  Copyright © 2017年 Macmini. All rights reserved.
//

#import "ChoosePatternViewController.h"

#import "BTCCommonBuyViewController.h"
#import "BTCCommonSellViewController.h"

@interface ChoosePatternViewController ()
@property (weak, nonatomic) IBOutlet UIButton *normalMode;
@property (weak, nonatomic) IBOutlet UIButton *safeMode;

@end

@implementation ChoosePatternViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    [self confriNavBar];
    [self configureTitle];
}

- (void)configureTitle
{
    if ([self.type isEqualToString:CoinType_Buy]) {
        [self.normalMode setTitle:@"普通购买" forState:0];
        [self.safeMode setTitle:@"安全购买" forState:0];
    } else {
      [self.normalMode setTitle:@"普通出售" forState:0];
       [self.safeMode setTitle:@"安全出售" forState:0];
    }
    
}
- (void)confriNavBar {
    
    self.navigationItem.title = @"选择交易模式";
//    
//    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
//    [button setTitle:@"返回" forState:UIControlStateNormal];
//    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [button addTarget:self action:@selector(clickButton) forControlEvents:UIControlEventTouchUpInside];
//    
//    UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
//    self.navigationItem.leftBarButtonItem =leftBarButtonItem;
     self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" imageName:@"navigationbar_back_withtext" target:self action:@selector(back)];
    UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [rightBtn setTitle:@"帮助" forState:UIControlStateNormal];
    [rightBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [rightBtn addTarget:self action:@selector(rightBarButtonItemPressed:) forControlEvents:UIControlEventTouchUpInside ];
    UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
    self.navigationItem.rightBarButtonItem = rightBarButtonItem;
}
-(void)rightBarButtonItemPressed:(id)sender
{
    [KeFuTools jumpToKeFu:self];
   
    
}
- (void)back {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

//普通模式 general
-  (IBAction)clickGeneralSellBtn:(id)sender {
    
    if ([self.type isEqualToString:CoinType_Buy]) {
        BTCCommonBuyViewController *bTCCommonBuyVC = [BTCCommonBuyViewController new];
        bTCCommonBuyVC.genre = CoinType_Buy_NormalModel;
        [self.navigationController pushViewController:bTCCommonBuyVC animated:YES];
        
    } else {
     //   BTCCommonBuyViewController *bTCCommonSellVC = [BTCCommonBuyViewController new];
        BTCCommonSellViewController *bTCCommonSellVC = [BTCCommonSellViewController new];
        bTCCommonSellVC.genre = CoinType_Sell_NormalModel;
        [self.navigationController pushViewController:bTCCommonSellVC animated:YES];
    }
    
}
//安全模式 safety
- (IBAction)clickSafetySellBtn:(id)sender {
    
    if ([self.type isEqualToString:CoinType_Buy]) {
        BTCCommonBuyViewController *bTCCommonBuyVC = [BTCCommonBuyViewController new];
        bTCCommonBuyVC.genre = CoinType_Buy_SafeModel;
        [self.navigationController pushViewController:bTCCommonBuyVC animated:YES];
    } else {
     //   BTCCommonBuyViewController *bTCCommonSellVC = [BTCCommonBuyViewController new];
        BTCCommonSellViewController *bTCCommonSellVC = [BTCCommonSellViewController new];
        bTCCommonSellVC.genre = CoinType_Sell_SafeModel;
        [self.navigationController pushViewController:bTCCommonSellVC animated:YES];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
